<?php 
include_once('connection/connection.php');
include('header.php');
include('menu.php');
include('config.php');
function getName($colName,$id)
{
	$sqlgetName="select distinct ".$colName."_name from tbl_lookup_location where ".$colName."_id=".$id;
	$querygetName=mysql_query($sqlgetName);
	$rowgetName=mysql_fetch_row($querygetName);
	return $rowgetName[0];
}
$frm=$_SESSION['form_id'];
$qr="select * from tbl_dtls_q3_loc where form_id='$frm'";
$res=mysql_query($qr);
$row=mysql_fetch_array($res);
$dis=$row['district_id'];
$dis_name=getName('district',$dis);
$_SESSION['dis_name']=$dis_name;
$tehsil=$row['tehsil_id'];
$id1=$row['id'];
$_SESSION['id1']=$id1;
$qr1="select census_subdistrict_name from tbl_lookup_location where district_id='$dis' and census_subdistrict_code='$tehsil'";
$res1=mysql_query($qr1);
$row1=mysql_fetch_array($res1);
if(isset($_POST['back']))
{ 
	header('Location: view_village_q3.php');
}	
if(isset($_POST['submit']))
{ 
	//echo $form_id=$_POST['form_id'];
	//echo $_SESSION['form_id']=$form_id;
	header('Location: view_q3_2.php');
}	
?>
<html>
<head>
<title>View Q3</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="file:///D|/Backup Rajasthan from new server/rajasthan/administrator/css/style_question.css" type="text/css" rel="stylesheet" />
<script language=javascript>
function PopupCenter(pageURL,title,w,h)
{
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);
	var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
</script> 
</head>
<body>
<div align="center">
<form action="" method="post" enctype="multipart/form-data">
	<table border="0" width="800" id="table1" cellspacing="0" cellpadding="0">
		<tr>
			<td height="30">
			<p align="center">
			<font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#000000">
			Questionnaire No. 3</font>
			</p>
			</td>
		</tr>
		<tr>
			<td height="19">
			<p align="center">
			<font face="Arial" style="font-size: 8.5pt" color="#000000">For 
			Field Survey (Village Level questionnaire) </font>
			</p>
			</td>
		</tr>
		<tr>
			<td height="18" colspan="2">
			<p align="center">
			<font style="font-size: 8.5pt" face="Arial" color="#000000">Page 1 </font></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td bgcolor="#EEEEEE" height="22"><font color="#000000">&nbsp;
			<font style="font-size: 8.5pt; font-weight: 700" face="Arial">
			Location </font></font>
			</td>
		</tr>
		<tr>
			<td height="132">
			<table border="1" width="800" id="table2" bgcolor="#FDF9EE" cellspacing="0" cellpadding="0" style="border-collapse:collapse; border-color:#99CCCC;">
				<tr>
					<td colspan="5">
					<span style="font-size: 4pt">&nbsp;</span></td>
				</tr>
				<tr>
					<td width="227" height="27">
					<font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;District</font></td>
					<td width="267">
				  <label id="district"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php $id="$row[district_id]"; echo "&nbsp;"; echo getName('district',$id);?></font></label>				  </td>
        			<td colspan="2">
						<font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Date&nbsp;&nbsp;</font></td>
            		<td width="185">
				  <label id="date"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo "$row[date]";?></font></label></td>
        		</tr>
				<tr>
					<td width="227" height="31">
						<font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Block </font></td>
				  <td width="267"><label id="block"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php $id="$row[block_id]"; echo "&nbsp;"; echo getName('block',$id);?></font></label>			      </td>
					<td colspan="2">
						<font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Revenue Tehsil&nbsp;&nbsp;&nbsp;</font>					</td>
				  <td width="185"><label id="tehsil"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php  $id="$row[tehsil_id]"; echo "&nbsp;"; echo "$row1[census_subdistrict_name]"?></font></label>			      </td>
			    </tr>
				<tr>
				  <td height="27"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Grampanchayat</font></td>
				  <td><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php $id="$row[panchayat_id]"; echo "&nbsp;"; echo getName('panchayat',$id);?></font></td>
				  <td colspan="2"><font style="font-size: 8.5pt" face="Verdana" color="#000000">&nbsp;Census Village &nbsp;&nbsp;Code</font></td>
				  <td><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo "$row[census_vil_code]";?></font></td>
			  </tr>
				
				<tr>
				  <td height="27"><font face="Verdana" style="font-size: 8.5pt" color="#000000"><font style="font-size: 8.5pt" face="Verdana" color="#000000">&nbsp;Name of the Census Village / Main Habitation </font></font></td>
				  <td><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php $id="$row[village_id]"; echo "&nbsp;"; echo getName('village',$id);?></font></td>
				  <td colspan="2"><font style="font-size: 8.5pt" face="Verdana" color="#000000">&nbsp;Form Id</font></td>
				  <td><font style="font-size: 8.5pt" face="Verdana" color="#000000">&nbsp;<?php echo "$row[form_id]";?></font></td>
			  </tr>
				<tr>
				  <td height="27"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Upload File</font></td>
				  <td colspan="4"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;
				  <?php 
				  if($row[file_name]!="")
				  {
				  echo $row[file_name]."&nbsp;&nbsp;&nbsp;&nbsp;<a href='#' style='text-decoration:none;color:#006600' onClick=PopupCenter('KmlFile.php?var=".$row[file_name]."','kml','800','700')><b></b></a>&nbsp;|&nbsp;<a href='download.php?download_file=".$row[file_name]."&dist=".$dis_name."' style='text-decoration:none;color:#006600' ><b>Download</b></a> ";
				  }
				  ?></font></td>
			  </tr>
				

				<tr>
					<td colspan="5">
					<span style="font-size: 4pt">&nbsp;</span></td>
				</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td bgcolor="#EEEEEE" height="22"><font color="#000000">&nbsp;
			<font style="font-size: 8.5pt; font-weight: 700" face="Arial">
			1.
			Habitation Details </font></font></td>
		</tr>
		<tr>
			<td>
			<table border="1" width="800" id="table4" cellspacing="0" cellpadding="0" bgcolor="#FDF9EE" style="border-collapse:collapse; border-color:#99CCCC;">
				<tr>
					<td colspan="11"><span style="font-size: 4pt">&nbsp;</span></td>
				</tr>
				<tr>
					<td width="23%" align="center" rowspan="2" bgcolor="#F7E6B7">
					<font style="font-size: 8.5pt" face="Verdana" color="#990000">
					Name of the Other Habitation</font></td>
					<td align="center" width="11%" rowspan="2" bgcolor="#F7E6B7">
					<address>
						<font style="font-size: 8.5pt; font-style: normal" face="Verdana" color="#990000">
						Code No. </font>
					</address>
					<address>
					<font face="Verdana" color="#990000" style="font-size: 8.5pt; font-style: normal">
						(Census Village/ IMIS)</font>
					</address>				  </td>
					<td align="center" width="8%" rowspan="2" valign="top" bgcolor="#F7E6B7">
					<address>
						<font style="font-size: 8.5pt; font-style: normal" face="Verdana" color="#990000">
						Type MH/ OH</font></address>				  </td>
					<td align="center" width="12%" rowspan="2" bgcolor="#F7E6B7">
					<address>
						<font style="font-size: 8.5pt; font-style: normal" face="Verdana" color="#990000">Status</font>
					</address>
					<address>
						<font style="font-size: 8.5pt; font-style: normal" face="Verdana" color="#990000">
						(E/ NT)</font></address>				  </td>
					<td align="center" width="14%" rowspan="2" bgcolor="#F7E6B7"><font style="font-size: 8.5pt; font-style: normal" face="Verdana" color="#990000">Longitude</font></td>
					<td align="center" width="14%" rowspan="2" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#990000">Latitude</font></td>
					<td align="center" width="14%" rowspan="2" bgcolor="#F7E6B7">
						<font style="font-size: 8.5pt" face="Verdana" color="#990000">Approx No. of Household in OH</font></td>
					<td align="center" height="22" colspan="4" bgcolor="#F7E6B7">
						<font style="font-size: 8.5pt" face="Verdana" color="#990000">Current Population</font></td>
				</tr>
				<tr>
					<td width="7%" height="16" align="center" bgcolor="#F7E6B7">
						<font style="font-size: 8.5pt" face="Verdana" color="#990000">SC</font></td>
					<td width="8%" align="center" bgcolor="#F7E6B7">
						<font style="font-size: 8.5pt" face="Verdana" color="#990000">ST</font></td>
					<td width="8%" align="center" bgcolor="#F7E6B7">
						<font style="font-size: 8.5pt" face="Verdana" color="#990000">Others</font></td>
					<td width="9%" align="center" bgcolor="#F7E6B7">
						<font style="font-size: 8.5pt" face="Verdana" color="#990000">Total</font></td>
				</tr>
				<?php
				$qr2="select * from tbl_dtls_q3_habit where loc_id='$id1' order by habit_code asc";
				$res2=mysql_query($qr2);
				while($row2=mysql_fetch_array($res2))
				{
				?>
				 <tr>
				<td width="23%" align="center">
					<label id="name"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$row2[habit_name]";?></font></label>				</td>
				<td width="11%" align="center"><label id="code"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$row2[habit_code]";?></font></label>				</td>
			   <td align="center" width="8%"><label id="type"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$row2[type_habit]";?></font></label></td>
				<td width="12%" align="center">
					<label id="status"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$row2[status_e_nt]";?></font></label>				</td>
				<td width="14%" align="center"><label id="long"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$row2[longitude]";?></font></label></td>
				<td width="14%" align="center"><label id="lat"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$row2[latitude]";?></font></label></td>
				<td width="14%" align="center"><label id="house"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$row2[num_household_oh]";?></font></label></td>
				<td width="8%" align="center">
					<label id="sc"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$row2[population_sc]";?></font></label>				</td>
				<td width="8%" align="center">
					<label id="st"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$row2[population_st]";?></font></label>				</td>
				<td width="10%" align="center">
					<label id="other"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$row2[population_other]";?></font></label>				</td>
				<td width="10%" align="center">
					<label id="total"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$row2[population_total]";?></font></label>				</td>
			</tr>
			<?php } ?>
			<tr><td colspan="9"></td></tr>
			</table>
			</td>
		</tr>
		<tr>
		  <td bgcolor="#EEEEEE" height="22"><font color="#000000">&nbsp; <font style="font-size: 8.5pt; font-weight: 700" face="Arial">No. of Unlisted Habitation</font></font></td>
		</tr>
		<tr><td>
		<table border="1" cellspacing="0" cellpadding="0" bgcolor="#FDF9EE" style="border-collapse:collapse; border-color:#99CCCC;">
		<tr><td width="23%" align="center" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#990000">Unlisted Habitation Name</font></td><td width="23%" align="center"  bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#990000">Longitude</font></td><td width="23%" align="center" bgcolor="#F7E6B7"><font style="font-size: 8.5pt" face="Verdana" color="#990000">Latitude</font></td></tr>
		<?php
				$qrUnhabit="select * from tbl_dtls_q3_unhabit where loc_id='$id1'";
				$resUnhabit=mysql_query($qrUnhabit);
				while($rowUnhabit=mysql_fetch_array($resUnhabit))
				{
				?>
		<tr><td><label id="unhabit1"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$rowUnhabit[unhabit_name]";?></font></label></td><td><label id="unhabit2"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$rowUnhabit[un_longitude]";?></font></label></td><td><label id="unhabit3"><font style="font-size: 8.5pt" face="Verdana"><?php echo "$rowUnhabit[un_latitude]";?></font></label></td></tr>
		<?php
		}
		?>
		</table>
		</td></tr>
		<tr>
			<td bgcolor="#EEEEEE" height="22"><font color="#000000">&nbsp;
			<font style="font-size: 8.5pt; font-weight: 700" face="Arial">
			2. </font></font><span style="font-weight: 700">
			<font face="Arial" style="font-size: 8.5pt" color="#000000">Name of 
			Key Person (s) Contacted/ Interviewed </font></span></td>
		</tr>
		<tr>
			<td>
				<table border="1" width="800" id="table5" bgcolor="#FDF9EE" cellspacing="0" cellpadding="0" style="border-collapse:collapse; border-color:#99CCCC;">
				<tr>
					<td colspan="2">
					<span style="font-size: 4pt">&nbsp;</span></td>
				</tr>
				<tr>
					<td width="241" height="33">
					<font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp; 
					Concerned PHED Officer (AEn / JEn) </font></td>
					<!--<td width="60"><input type="checkbox" name="cpo" value="cpo" onClick="enable_text1(this.checked)"></td>-->
				  <td width="506"><label id="p1"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo "$row[person_phed_officer]";?></font></label></td>
					
				</tr>
				<tr>
					<td width="241" height="28">
					<font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp; 
					PHED Sub- Division</font></td>
					<!--<td width="60"><input type="checkbox" name="psd" value="psd" onClick="enable_text2(this.checked)"></td>-->
				  <td width="506"><label id="p2"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo "$row[person_phed_sub]";?></font></label></td>
					
				</tr>
				<tr>
					<td width="241" height="27">
					<font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp; Sarpanch / Dy. Sarpanch</font></td>
					<!--<td width="60"><input type="checkbox" name="sds" value="sds" onClick="enable_text3(this.checked)"></td>-->
				  <td width="506"><label id="p3"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo "$row[person_sarpanch]";?></font></label></td>
					
				</tr>
				<tr>
					<td width="241" height="33">
					<font style="font-size: 8.5pt" face="Verdana" color="#000000">&nbsp; 
					Gram Sewak </font></td>
					<!--<td width="60"><input type="checkbox" name="gs" value="gs" onClick="enable_text4(this.checked)"></td>-->
				  <td width="506"><label id="p4"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo "$row[person_gramsevak]";?></font></label></td>
					
				</tr>
				<tr>
					<td width="241" height="31">
					<font style="font-size: 8.5pt" face="Verdana" color="#000000">&nbsp; 
					Patwari </font></td>
					<!--<td width="60" height="20"><input type="checkbox" name="patwari" value="patwari" onClick="enable_text5(this.checked)"></td>-->
				  <td width="506" height="31"><label id="p5"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo "$row[person_patwari]";?></font></label></td>
					
				</tr>
				<tr>
					<td width="241" height="32">
					<font style="font-size: 8.5pt" face="Verdana" color="#000000">&nbsp; 
					Head Master, Govt. School</font></td>
					<!--<td width="60" height="20"><input type="checkbox" name="hms" value="hms" onClick="enable_text6(this.checked)"></td>-->
				  <td width="506" height="32"><label id="p6"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo "$row[person_headmaster]";?></font></label></td>
					
				</tr>
				<tr>
					<td width="241" height="30">
					<font style="font-size: 8.5pt" face="Verdana" color="#000000">&nbsp; 
					PHED Operator / Staff</font></td>
					<!--<td width="60" height="20"><input type="checkbox" name="phed" value="phed" onClick="enable_text7(this.checked)"></td>-->
				  <td width="506" height="30"><label id="p7"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo "$row[person_phed_operator]";?></font></label></td>
					
				</tr>
				
				</table>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		
		<tr>
			<td>
			<p align="center">
			<input type="submit" value="Back" name="back" style="font-size: 8pt;font-family:Verdana; border-style: solid; border-width: 1px">&nbsp;&nbsp;
			<input type="submit" value="Next" name="submit" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px">&nbsp;</p>
			</td>
		</tr>
		</table>
</form>		
</div>
</body>
</html>